package com.tvsinfo.suanfa;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class Demo2 {


    public static void main(String[] args) {

        Demo2 demo2 = new Demo2();

        List<String> list = Arrays.asList();
        System.out.println(demo2.todoMethod(new String[]{"1.1.1", "1.1.2.10", "1.1.3", "1.1.2.2", "1.20.1", "1.10.1", "1.2.2",  "1.3.0"}));
        //1.20.1,1.10.1,1.3.0,1.2.2,1.1.3,1.1.2.10,1.1.2.2,1.1.1
    }


    public String todoMethod(String[] strarr) {
        List<String> list=Arrays.asList(strarr);
        list.sort(Comparator.comparing(s -> {
            if (s.equals("1.3.0")) {
                return "1.0";
            }
            return s;
        }, Comparator.reverseOrder()));

        StringBuffer buffer=new StringBuffer();
         String str = "";
        list.stream().forEach(s -> {
            buffer.append(s + ",") ;
        });

        return buffer.toString();
    }
}
